package org.yh;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

import lombok.extern.slf4j.Slf4j;

/**
 * Hello world!
 *
 */
@Slf4j
@EnableEurekaClient
@SpringBootApplication
public class ConsumerApp {
	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		SpringApplication.run(ConsumerApp.class, args);
		log.info("order消费端启动完成：耗时" + (System.currentTimeMillis() - start) + "ms");
	}

//@LoadBalanced就能让这个RestTemplate在请求时拥有客户端负载均衡的能力
	@Bean
	@LoadBalanced
	RestTemplate restTemplate() {
		return new RestTemplate();
	}

}
